import Vue from 'vue'
import Router from 'vue-router'
import Home from "../views/Home.vue";
import User from "../components/UserManagement.vue";
import Page1 from "../components/Page1.vue";
import Page2 from "../components/Page2.vue";
import Main from "../components/Main.vue";
import Login from "../views/Login.vue";
import ArticleEdit from "../components/ArticleEdit.vue";
import NucleicAcidManagement from "../components/NucleicAcidManagement.vue";
import CommManagement from "../components/CommManagement.vue";
import UserManagement from "../components/UserManagement.vue";
import ArticleManagement from "../components/ArticleManagement.vue";
import ArticleManagement_comm from "../components/ArticleManagement_comm.vue";
import statistics from "../components/Statistics.vue";

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'home',
      component: Home,
      redirect: 'main', //直接重定向 到首页
      meta: {
        requireAuth: true,
        isCommAdmin: true,
      },
      children: [
        {
          path: '/main', name: 'main', component: Main, meta: {requireAuth: true,},
        },
        {path: '/user', name: 'UserManagement', component: UserManagement, meta: {requireAuth: true}},
        {path: '/page1', name: 'page1', component: Page1},
        {path: '/page2', name: 'page2', component: Page2},
        {path: '/edit', name: 'articleEdit', component: ArticleEdit},
        {path: '/ncmanage', name: 'nucleicAcidManagement', component: NucleicAcidManagement},
        {path: '/cmanage', name: 'commManagement', component: CommManagement, meta: {isCommAdmin: true}},
        {path: '/statistics', name: 'statistics', component: statistics, meta: {isCommAdmin: true}},
        {path: '/armanage/na_article', name: 'na_article', component: ArticleManagement, meta: {isCommAdmin: true}},
        {path: '/armanage/comm_article', name: 'comm_article', component: ArticleManagement_comm, meta: {isCommAdmin: true}},
      ]
    },

    {
      path: '/login',
      name: 'login',
      component: Login
    }
  ]
})
